from os import getcwd, path as os_path
from . import bookmark, tag

bmk_path = ""
tag_path = ""

def init_store():
    global bmk_path, tag_path
    print("init store...")
    cwd = os_path.abspath(getcwd())
    bmk_path = os_path.join(cwd, "bmk.db")
    tag_path = os_path.join(cwd, "tag.db")
    loaded = all((
        bookmark.load(bmk_path),
        tag.load(tag_path),
    ))
    if not loaded:
        commit_store()

def commit_store():
    bookmark.save(bmk_path)
    tag.save(tag_path)
